<include file="public/layout" />

<style>

    dd.opt table{

        width: 100%;

    }

    dd.opt tr{

        border: 1px solid #f4f4f4;

        padding: 8px;

    }

    dd.opt tr td{

        border: 1px solid #f4f4f4;

    }

</style>

<script src="__ROOT__/public/static/js/layer/laydate/laydate.js"></script>

<style type="text/css">

    html, body {

        overflow: visible;

    }

</style>



<body style="background-color: #FFF; overflow: auto;">

<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>

<div id="append_parent"></div>

<div id="ajaxwaitid"></div>

<div class="page">

    <div class="fixed-bar">

        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>

            <div class="subject">

                <h3>充值赠送管理 - 编辑商品促销活动</h3>

                <h5>网站系统编辑商品促销活动</h5>

            </div>

        </div>

    </div>

    <form class="form-horizontal" id="promotion" action="{:U('Admin/Promotion/recharge_give_save')}" method="post">

        <input type="hidden" name="id" value="{$info.id}">

        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit"><label>供应商</label></dt>
                <dd class="opt">
                    <div class="sDiv2">
                        <if condition="$suppliers_id"><select name="suppliers" class="small form-control">
                            <option value="{$suppliers_id.suppliers_id}">{$suppliers_id.suppliers_name}</option>
                        </select>
                            <else/>
                            <select name="suppliers" class="small form-control">
                                <option value="0">请选择供应商</option>
                                <volist name="suppliers" id="vo">
                                    <option
                                    <if condition="$vo['suppliers_id'] eq $info['suppliers_id']">selected</if>
                                    value="{$vo.suppliers_id}">{$vo.suppliers_name}</option>
                                </volist>
                            </select></if>
                    </div>
                </dd>
            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>充值金额</label>

                </dt>

                <dd class="opt">

                    <input type="text" name="money" id="money" value="{$info.money}" onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">

                    <p class="notic">充值金额</p>

                </dd>

            </dl>

           

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>赠送金额</label>

                </dt>

                <dd class="opt">

                    <input type="text" name="give_money" id="give_money" value="{$info.give_money}"  onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="input-txt">

                    <p class="notic">赠送金额(单位:元)</p>

                </dd>

            </dl>


            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>开始时间</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="start_time" name="start_time" value="{$info.start_time|date='Y-m-d H:i:s',###}"  class="input-txt">

                    <p class="notic">优惠开始时间</p>

                </dd>

            </dl>

            <dl class="row">

                <dt class="tit">

                    <label><em>*</em>结束时间</label>

                </dt>

                <dd class="opt">

                    <input type="text" id="end_time" name="end_time" value="{$info.end_time|date='Y-m-d H:i:s',###}" class="input-txt">

                    <p class="notic">优惠结束时间</p>

                </dd>

            </dl>

            <div class="bot"><a onclick="$('#promotion').submit();" class="ncap-btn-big ncap-btn-green">确认提交</a></div>

        </div>

    </form>

</div>

<script type="text/javascript">


    $(function () {

        $('#start_time').layDate();

        $('#end_time').layDate();

    });

    //    function adsubmit(){

    //        if($('#name').val() ==''){

    //            layer.msg('活动名称不能为空');return false;

    //        }

    //        if($('input[name=expression]').val() ==''){

    //            layer.msg('优惠不能为空');return false;

    //        }

    //        $('#promotion').submit();

    //    }

    function selectGoods(){

        var goods_id = [];

        //过滤选择重复商品

        $('input[name*="goods_id"]').each(function(i,o){

            goods_id.push($(o).val());

        });

        var url = '/index.php?m=Admin&c=Promotion&a=search_goods&goods_id='+goods_id+'&t='+Math.random();

        layer.open({

            type: 2,

            title: '选择商品',

            shadeClose: true,

            shade: 0.3,

            area: ['70%', '80%'],

            content: url,

        });

    }


    $(function () {

        $("#promotion").validate({

            debug: false, //调试模式取消submit的默认提交功能

            focusInvalid: false, //当为false时，验证无效时，没有焦点响应

            onkeyup: false,

            submitHandler: function(form){   //表单提交句柄,为一回调函数，带一个参数：form

                 form.submit();   //提交表单

            },

            ignore:":button",	//不验证的元素

            rules:{

                money:{

                    required:true

                },

                give_money:{

                    required:true

                },

                start_time:{

                    required:true

                },

                end_time:{

                    required:true

                },

            },

            messages:{

                money:{

                    required:"请填写充值金额"

                },

                give_money:{

                    required:"请填写赠送金额"

                },

                start_time:{

                    required:"请选择时间"

                },

                end_time:{

                    required:"请选择时间"

                },

            }

        });

    })

    $(document).ready(function(){

        $('#start_time').layDate();

        $('#end_time').layDate();



    })

</script>

</body>

</html>